package experiment8;

import java.util.Scanner;

public class No_1 {
    public static void main(String []args) throws ArrayIndexOutBoundsException {
        int[] a=new int[100];
        int j;
        for (int i=0;i<100;i++){
            a[i]=(int)(Math.random()*100);
        }

        Scanner input=new Scanner(System.in);

        while (true){
            System.out.println("请选择数组的下标：");
            j=input.nextInt();
            if (j>=99||j<0){
                throw new ArrayIndexOutBoundsException();
            }
            System.out.println(a[j]);
        }
    }
}

class ArrayIndexOutBoundsException extends Exception{
    public ArrayIndexOutBoundsException(){
        super("Outof Boundso");
    }
}